import 'dart:io';

import 'package:flutter_taotaoshipin/http/request/ad_order_create_csj_request.dart';
import 'package:flutter_taotaoshipin/model/ad_order_create_csj_entity.dart';
import 'package:flutter_taotaoshipin/model/base_entity.dart';
import 'package:flutter_taotaoshipin/util/device_utils.dart';
import 'package:flutter_taotaoshipin/value/constant.dart';
import 'package:hi_net/hi_net.dart';

class AdOrderDao {
  /// 穿山甲激励广告下单
  static Future<BaseEntity<AdOrderCreateCsjEntity>> createCsj({
    required String dramaId,
    required String adverId,
    String codeId = '',
  }) async {
    var request = AdOrderCreateCsjRequest();
    request.add('drama_id', dramaId);
    request.add('adver_id', adverId);
    request.add('code_id', codeId);
    request.add('ip', InternetAddress.loopbackIPv4.address);
    request.add('os', Constant.from);
    request.add('udid', Device.udid());
    var result = await HiNet.getInstance().fire(request);
    return BaseEntity<AdOrderCreateCsjEntity>.fromJson(result);
  }
}
